@import "./_themes.scss";
//遍历主题map
@mixin themeify {
    @each $theme-name, $theme-map in $themes {
        // global 把局部变量强升为全局变量
        $theme-map: $theme-map !global;
        //判断html的data-theme的属性值 #{}是sass的插值表达式
        //& sass嵌套里的父容器标识  @content是混合器插槽，像vue的slot
        [data-theme="#{$theme-name}"] & {
            @content;
        }
    }
}
    
//声明一个根据Key获取颜色的function
@function themed($key) {
    @return map-get($theme-map, $key);
}
    
//获取背景颜色
@mixin background_color($color, $opacity) {
    @include themeify {
        background-color: rgba(themed($color), $opacity) !important;
    }
}
    
//获取字体颜色
@mixin font_color($color) {
    @include themeify {
        color: themed($color)!important;
    }
}
    
//获取边框颜色
@mixin border_color($color) {
    @include themeify {
        border-color: themed($color) !important;
    }
}
//获取边框颜色
@mixin border_color_opacity($color, $opacity) {
    @include themeify {
        border-color: rgba(themed($color), $opacity) !important;
    }
}

//获取svg颜色
@mixin stroke_color($color) {
    @include themeify {
        stroke: themed($color)!important;
    }
}

//获取三角形底部颜色
@mixin tri_bottom_color($color) {
    @include themeify {
        border-bottom-color: themed($color)!important;
    }
}
//获取三角形顶部颜色
@mixin tri_top_color($color) {
    @include themeify {
        border-top-color: themed($color)!important;
    }
}
// 虚线主题色
@mixin dotted_style($color) {
    @include themeify {
        background: linear-gradient(
            to right,
            transparent 0%,
            transparent 50%,
            themed($color) 50%,
            #fff 100%
        ) !important;
        background-size: 3px 1px !important;
        background-repeat: repeat-x !important;
    }
}